home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / Interfaces&Libraries / Universal / Interfaces / CIncludes / Fonts.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-12  |  10.8 KB  |  410 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Fonts.h
  3.  
  4.      Contains:    Font Manager Interfaces.
  5.  
  6.      Version:    Technology:    MacOS
  7.                  Release:    Universal Interfaces 3.0.1
  8.  
  9.      Copyright:    © 1985-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. */
  18. #ifndef __FONTS__
  19. #define __FONTS__
  20.  
  21. #ifndef __TYPES__
  22. #include <Types.h>
  23. #endif
  24. #ifndef __QUICKDRAW__
  25. #include <Quickdraw.h>
  26. #endif
  27.  
  28.  
  29.  
  30. #if PRAGMA_ONCE
  31. #pragma once
  32. #endif
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37.  
  38. #if PRAGMA_IMPORT
  39. #pragma import on
  40. #endif
  41.  
  42. #if PRAGMA_STRUCT_ALIGN
  43.     #pragma options align=mac68k
  44. #elif PRAGMA_STRUCT_PACKPUSH
  45.     #pragma pack(push, 2)
  46. #elif PRAGMA_STRUCT_PACK
  47.     #pragma pack(2)
  48. #endif
  49.  
  50.  
  51. enum {
  52.     systemFont                    = 0,
  53.     applFont                    = 1
  54. };
  55.  
  56.  
  57. /*
  58.     The following font constants are deprecated.  
  59.     Please use GetFNum() to look up the font ID by name.
  60. */
  61.  
  62. enum {
  63.     kFontIDNewYork                = 2,
  64.     kFontIDGeneva                = 3,
  65.     kFontIDMonaco                = 4,
  66.     kFontIDVenice                = 5,
  67.     kFontIDLondon                = 6,
  68.     kFontIDAthens                = 7,
  69.     kFontIDSanFrancisco            = 8,
  70.     kFontIDToronto                = 9,
  71.     kFontIDCairo                = 11,
  72.     kFontIDLosAngeles            = 12,
  73.     kFontIDTimes                = 20,
  74.     kFontIDHelvetica            = 21,
  75.     kFontIDCourier                = 22,
  76.     kFontIDSymbol                = 23,
  77.     kFontIDMobile                = 24
  78. };
  79.  
  80. #if OLDROUTINENAMES
  81.  
  82. enum {
  83.     newYork                        = kFontIDNewYork,
  84.     geneva                        = kFontIDGeneva,
  85.     monaco                        = kFontIDMonaco,
  86.     venice                        = kFontIDVenice,
  87.     london                        = kFontIDLondon,
  88.     athens                        = kFontIDAthens,
  89.     sanFran                        = kFontIDSanFrancisco,
  90.     toronto                        = kFontIDToronto,
  91.     cairo                        = kFontIDCairo,
  92.     losAngeles                    = kFontIDLosAngeles,
  93.     times                        = kFontIDTimes,
  94.     helvetica                    = kFontIDHelvetica,
  95.     courier                        = kFontIDCourier,
  96.     symbol                        = kFontIDSymbol,
  97.     mobile                        = kFontIDMobile
  98. };
  99.  
  100. #endif  /* OLDROUTINENAMES */
  101.  
  102.  
  103. enum {
  104.     commandMark                    = 17,
  105.     checkMark                    = 18,
  106.     diamondMark                    = 19,
  107.     appleMark                    = 20
  108. };
  109.  
  110.  
  111. enum {
  112.     propFont                    = 36864L,
  113.     prpFntH                        = 36865L,
  114.     prpFntW                        = 36866L,
  115.     prpFntHW                    = 36867L,
  116.     fixedFont                    = 45056L,
  117.     fxdFntH                        = 45057L,
  118.     fxdFntW                        = 45058L,
  119.     fxdFntHW                    = 45059L,
  120.     fontWid                        = 44208L
  121. };
  122.  
  123. struct FMInput {
  124.     short                             family;
  125.     short                             size;
  126.     Style                             face;
  127.     Boolean                         needBits;
  128.     short                             device;
  129.     Point                             numer;
  130.     Point                             denom;
  131. };
  132. typedef struct FMInput FMInput;
  133.  
  134. struct FMOutput {
  135.     short                             errNum;
  136.     Handle                             fontHandle;                    /* the previous "privateFontResult" was a mistake! */
  137.     UInt8                             boldPixels;
  138.     UInt8                             italicPixels;
  139.     UInt8                             ulOffset;
  140.     UInt8                             ulShadow;
  141.     UInt8                             ulThick;
  142.     UInt8                             shadowPixels;
  143.     SInt8                             extra;
  144.     UInt8                             ascent;
  145.     UInt8                             descent;
  146.     UInt8                             widMax;
  147.     SInt8                             leading;
  148.     SInt8                             curStyle;
  149.     Point                             numer;
  150.     Point                             denom;
  151. };
  152. typedef struct FMOutput FMOutput;
  153.  
  154. typedef FMOutput *                        FMOutPtr;
  155. typedef FMOutput *                        FMOutputPtr;
  156. struct FontRec {
  157.     short                             fontType;                    /*font type*/
  158.     short                             firstChar;                    /*ASCII code of first character*/
  159.     short                             lastChar;                    /*ASCII code of last character*/
  160.     short                             widMax;                        /*maximum character width*/
  161.     short                             kernMax;                    /*negative of maximum character kern*/
  162.     short                             nDescent;                    /*negative of descent*/
  163.     short                             fRectWidth;                    /*width of font rectangle*/
  164.     short                             fRectHeight;                /*height of font rectangle*/
  165.     unsigned short                     owTLoc;                        /*offset to offset/width table*/
  166.     short                             ascent;                        /*ascent*/
  167.     short                             descent;                    /*descent*/
  168.     short                             leading;                    /*leading*/
  169.     short                             rowWords;                    /*row width of bit image / 2 */
  170. };
  171. typedef struct FontRec FontRec;
  172.  
  173. typedef FontRec *                        FontRecPtr;
  174. typedef FontRecPtr *                    FontRecHdl;
  175. struct FMetricRec {
  176.     Fixed                             ascent;                        /*base line to top*/
  177.     Fixed                             descent;                    /*base line to bottom*/
  178.     Fixed                             leading;                    /*leading between lines*/
  179.     Fixed                             widMax;                        /*maximum character width*/
  180.     Handle                             wTabHandle;                    /*handle to font width table*/
  181. };
  182. typedef struct FMetricRec FMetricRec;
  183.  
  184. /*
  185.    typedef struct FMetricRec FMetricRec, *FMetricRecPtr;
  186.    typedef FMetricRecPtr *FMetricRecHandle;
  187. */
  188. typedef FMetricRec *                    FMetricRecPtr;
  189. typedef FMetricRecPtr *                    FMetricRecHandle;
  190. struct WidEntry {
  191.     short                             widStyle;                    /*style entry applies to*/
  192. };
  193. typedef struct WidEntry WidEntry;
  194.  
  195. struct WidTable {
  196.     short                             numWidths;                    /*number of entries - 1*/
  197. };
  198. typedef struct WidTable WidTable;
  199.  
  200. struct AsscEntry {
  201.     short                             fontSize;
  202.     short                             fontStyle;
  203.     short                             fontID;                        /*font resource ID*/
  204. };
  205. typedef struct AsscEntry AsscEntry;
  206.  
  207. struct FontAssoc {
  208.     short                             numAssoc;                    /*number of entries - 1*/
  209. };
  210. typedef struct FontAssoc FontAssoc;
  211.  
  212. struct StyleTable {
  213.     short                             fontClass;
  214.     long                             offset;
  215.     long                             reserved;
  216.     char                             indexes[48];
  217. };
  218. typedef struct StyleTable StyleTable;
  219.  
  220. struct NameTable {
  221.     short                             stringCount;
  222.     Str255                             baseFontName;
  223. };
  224. typedef struct NameTable NameTable;
  225.  
  226. struct KernPair {
  227.     char                             kernFirst;                    /*1st character of kerned pair*/
  228.     char                             kernSecond;                    /*2nd character of kerned pair*/
  229.     short                             kernWidth;                    /*kerning in 1pt fixed format*/
  230. };
  231. typedef struct KernPair KernPair;
  232.  
  233. struct KernEntry {
  234.     short                             kernStyle;                    /*style the entry applies to*/
  235.     short                             kernLength;                    /*length of this entry*/
  236. };
  237. typedef struct KernEntry KernEntry;
  238.  
  239. struct KernTable {
  240.     short                             numKerns;                    /*number of kerning entries*/
  241. };
  242. typedef struct KernTable KernTable;
  243.  
  244. struct WidthTable {
  245.     Fixed                             tabData[256];                /*character widths*/
  246.     Handle                             tabFont;                    /*font record used to build table - the previous FontResult was a mistake!*/
  247.     long                             sExtra;                        /*space extra used for table*/
  248.     long                             style;                        /*extra due to style*/
  249.     short                             fID;                        /*font family ID*/
  250.     short                             fSize;                        /*font size request*/
  251.     short                             face;                        /*style (face) request*/
  252.     short                             device;                        /*device requested*/
  253.     Point                             inNumer;                    /*scale factors requested*/
  254.     Point                             inDenom;                    /*scale factors requested*/
  255.     short                             aFID;                        /*actual font family ID for table*/
  256.     Handle                             fHand;                        /*family record used to build up table*/
  257.     Boolean                         usedFam;                    /*used fixed point family widths*/
  258.     UInt8                             aFace;                        /*actual face produced*/
  259.     short                             vOutput;                    /*vertical scale output value*/
  260.     short                             hOutput;                    /*horizontal scale output value*/
  261.     short                             vFactor;                    /*vertical scale output value*/
  262.     short                             hFactor;                    /*horizontal scale output value*/
  263.     short                             aSize;                        /*actual size of actual font used*/
  264.     short                             tabSize;                    /*total size of table*/
  265. };
  266. typedef struct WidthTable WidthTable;
  267.  
  268. typedef WidthTable *                    WidthTablePtr;
  269. typedef WidthTablePtr *                    WidthTableHdl;
  270.  
  271. struct FamRec {
  272.     short                             ffFlags;                    /*flags for family*/
  273.     short                             ffFamID;                    /*family ID number*/
  274.     short                             ffFirstChar;                /*ASCII code of 1st character*/
  275.     short                             ffLastChar;                    /*ASCII code of last character*/
  276.     short                             ffAscent;                    /*maximum ascent for 1pt font*/
  277.     short                             ffDescent;                    /*maximum descent for 1pt font*/
  278.     short                             ffLeading;                    /*maximum leading for 1pt font*/
  279.     short                             ffWidMax;                    /*maximum widMax for 1pt font*/
  280.     long                             ffWTabOff;                    /*offset to width table*/
  281.     long                             ffKernOff;                    /*offset to kerning table*/
  282.     long                             ffStylOff;                    /*offset to style mapping table*/
  283.     short                             ffProperty[9];                /*style property info*/
  284.     short                             ffIntl[2];                    /*for international use*/
  285.     short                             ffVersion;                    /*version number*/
  286. };
  287. typedef struct FamRec FamRec;
  288.  
  289. typedef SInt16                             FontPointSize;
  290. typedef SInt16                             FontFamilyID;
  291. EXTERN_API( void )
  292. InitFonts                        (void)                                                        ONEWORDINLINE(0xA8FE);
  293.  
  294. EXTERN_API( void )
  295. GetFontName                        (short                     familyID,
  296.                                  Str255                 name)                                ONEWORDINLINE(0xA8FF);
  297.  
  298. EXTERN_API( void )
  299. GetFNum                            (ConstStr255Param         name,
  300.                                  short *                familyID)                            ONEWORDINLINE(0xA900);
  301.  
  302. EXTERN_API( Boolean )
  303. RealFont                        (short                     fontNum,
  304.                                  short                     size)                                ONEWORDINLINE(0xA902);
  305.  
  306. EXTERN_API( void )
  307. SetFontLock                        (Boolean                 lockFlag)                            ONEWORDINLINE(0xA903);
  308.  
  309. EXTERN_API( FMOutPtr )
  310. FMSwapFont                        (const FMInput *        inRec)                                ONEWORDINLINE(0xA901);
  311.  
  312. EXTERN_API( void )
  313. SetFScaleDisable                (Boolean                 fscaleDisable)                        ONEWORDINLINE(0xA834);
  314.  
  315. EXTERN_API( void )
  316. FontMetrics                        (FMetricRecPtr             theMetrics)                            ONEWORDINLINE(0xA835);
  317.  
  318. EXTERN_API( void )
  319. SetFractEnable                    (Boolean                 fractEnable)                        ONEWORDINLINE(0xA814);
  320.  
  321. EXTERN_API( short )
  322. GetDefFontSize                    (void)                                                        FIVEWORDINLINE(0x3EB8, 0x0BA8, 0x6604, 0x3EBC, 0x000C);
  323.  
  324. EXTERN_API( Boolean )
  325. IsOutline                        (Point                     numer,
  326.                                  Point                     denom)                                TWOWORDINLINE(0x7000, 0xA854);
  327.  
  328. EXTERN_API( void )
  329. SetOutlinePreferred                (Boolean                 outlinePreferred)                    TWOWORDINLINE(0x7001, 0xA854);
  330.  
  331. EXTERN_API( Boolean )
  332. GetOutlinePreferred                (void)                                                        TWOWORDINLINE(0x7009, 0xA854);
  333.  
  334. EXTERN_API( OSErr )
  335. OutlineMetrics                    (short                     byteCount,
  336.                                  const void *            textPtr,
  337.                                  Point                     numer,
  338.                                  Point                     denom,
  339.                                  short *                yMax,
  340.                                  short *                yMin,
  341.                                  FixedPtr                 awArray,
  342.                                  FixedPtr                 lsbArray,
  343.                                  RectPtr                 boundsArray)                        TWOWORDINLINE(0x7008, 0xA854);
  344.  
  345. EXTERN_API( void )
  346. SetPreserveGlyph                (Boolean                 preserveGlyph)                        TWOWORDINLINE(0x700A, 0xA854);
  347.  
  348. EXTERN_API( Boolean )
  349. GetPreserveGlyph                (void)                                                        TWOWORDINLINE(0x700B, 0xA854);
  350.  
  351. EXTERN_API( OSErr )
  352. FlushFonts                        (void)                                                        TWOWORDINLINE(0x700C, 0xA854);
  353.  
  354. #if CGLUESUPPORTED
  355. EXTERN_API_C( void )
  356. getfnum                            (const char *            theName,
  357.                                  short *                familyID);
  358.  
  359. EXTERN_API_C( void )
  360. getfontname                        (short                     familyID,
  361.                                  char *                    theName);
  362.  
  363. #endif  /* CGLUESUPPORTED */
  364.  
  365. EXTERN_API( short )
  366. GetSysFont                        (void)                                                        TWOWORDINLINE(0x3EB8, 0x0BA6);
  367.  
  368. EXTERN_API( short )
  369. GetAppFont                        (void)                                                        TWOWORDINLINE(0x3EB8, 0x0984);
  370.  
  371.  
  372. EXTERN_API( void )
  373. AntiTextSetApplicationAware        (Boolean                 aware)                                TWOWORDINLINE(0x7024, 0xA854);
  374.  
  375. EXTERN_API( Boolean )
  376. AntiTextGetApplicationAware        (void)                                                        TWOWORDINLINE(0x7025, 0xA854);
  377.  
  378. EXTERN_API( void )
  379. AntiTextSetEnabled                (Boolean                 enabled)                            TWOWORDINLINE(0x7026, 0xA854);
  380.  
  381. EXTERN_API( Boolean )
  382. AntiTextGetEnabled                (void)                                                        TWOWORDINLINE(0x7027, 0xA854);
  383.  
  384. EXTERN_API( Boolean )
  385. AntiTextIsAntiAliased            (Point                     numer,
  386.                                  Point                     denom)                                TWOWORDINLINE(0x7028, 0xA854);
  387.  
  388.  
  389.  
  390. #if PRAGMA_STRUCT_ALIGN
  391.     #pragma options align=reset
  392. #elif PRAGMA_STRUCT_PACKPUSH
  393.     #pragma pack(pop)
  394. #elif PRAGMA_STRUCT_PACK
  395.     #pragma pack()
  396. #endif
  397.  
  398. #ifdef PRAGMA_IMPORT_OFF
  399. #pragma import off
  400. #elif PRAGMA_IMPORT
  401. #pragma import reset
  402. #endif
  403.  
  404. #ifdef __cplusplus
  405. }
  406. #endif
  407.  
  408. #endif /* __FONTS__ */
  409.  
  410.